import { Injectable } from '@angular/core';
import { Http} from "@angular/http";
import { Observable} from "rxjs";
import {GlobalService} from "../global.service";

@Injectable()
export class UserService {

  constructor(
    public http:Http,
    private globalService:GlobalService,
  ) { }

  registerInfo(data): Observable<any>{
    return this.http.post(this.globalService.api+"/services/auth/register",data);
  }

  forgetPw(data) : Observable<any>{
    return this.http.post(this.globalService.api+"/services/auth/forgetPw/sendEmail",data);
  }

  findForgetInfoById(Id): Observable<any>{
    return this.http.get(this.globalService.api+"/services/auth/findForgetInfoById/"+Id);
  }

  resetPassword(data) : Observable<any>{
    return this.http.post(this.globalService.api+"/services/auth/resetPassword",data);
  }

  examLogin(data): Observable<any>{
    return this.http.post(this.globalService.api+"/services/auth/examLogin",data);
  }

  getAccountList(data): Observable<any>{
    return this.http.post(this.globalService.api+"/services/auth/accountList",data);
  }

  updateStatus(data): Observable<any>{
    return this.http.post(this.globalService.api+"/services/auth/register",data);
  }

  getRoles(data): Observable<any>{
    return this.http.post(this.globalService.api+"/services/auth/getRoles",data);
  }

  updateRole(data): Observable<any>{
    return this.http.post(this.globalService.api+"/services/auth/updateRole",data);
  }

  getImageList(data): Observable<any>{
    return this.http.post(this.globalService.api+"/services/auth/getHomeResource",data);
  }

  updateHomeResource(data): Observable<any>{
    return this.http.post(this.globalService.api+"/services/auth/saveHomeResource",data);
  }

  deleteHomeResource(data): Observable<any>{
    return this.http.post(this.globalService.api+"/services/auth/saveHomeResource",data);
  }
}
